Templates Lab
In this lab you deliver a demonstration of deploying an application in Red Hat® OpenShift® Container Platform using templates. You portray a developer who wants to deploy a Node.js application and Mongo database from an OpenShift template. You review the different template parameters and deployment environment variables created for that application in an effort to understand how templates connect the various tiers of an application.
You take Actions in the OpenShift Container Platform interface, and Explain activities, product features, resources, and concepts.
[NOTE] You may have already done some of these demonstrations in earlier labs. If you have, you can skip them and use the existing Project and deployment.
Deploy a template
Verify that all components are deployed
Observe that environment variables are used
Use the Pod terminal to explore a running container
1. Provision Lab Environment
| If you previously set up an environment for this class, you can skip this section and go directly to the Demonstrate Authentication to OpenShift section. |
In this section, you provision the lab environment to provide access to all of the components required to perform the labs, including access to the shared OpenShift cource cluster. The lab environment is a shared cloud-based environment, so that you can access it over the Internet from anywhere. However, do not expect performance to match a dedicated environment.
| You need to request two catalog items for this course! Make sure you request both the OPENTLC OpenShift 4.6 Shared Access and OpenShift 4 Student VM catalog items. |
Go to the OPENTLC lab portal and use your OPENTLC credentials to log in.
If you do not remember your password, go to the OPENTLC Account Management page to reset your password. You will need to request two catalog items.
The first catalog item grants you access to a shared OpenShift Cluster: .. Navigate to Services → Catalogs → All Services → OPENTLC OpenShift 4 Labs. .. On the left, select OPENTLC OpenShift 4.6 Shared Access. .. On the right, click Order. .. On the bottom right, click Submit.
The second catalog item creates a Red Hat Enterprise Linux Virtual Machine with all necessary tools pre-configured. This way you have a well-defined environment to run your lab commands in.
Navigate to Services → Catalogs → All Services → OPENTLC OpenShift 4 Labs.
On the left, select OpenShift 4 Student VM.
On the right, click Order.
From the OpenShift Release dropdown select 4.6
From the Region dropdown select a region that is close to you.
On the bottom right, click Submit.
Do not select App Control → Start after ordering a catalog item. After a few minutes, expect to receive two emails with instructions on how to connect to the environment.
While you are waiting for the environment to build, read the email carefully and specifically note the following:
One email includes a URL for the OpenShift web console similar to https://console-openshift-console.apps.shared-na46.openshift.opentlc.com/dashboards.
The other e-mail includes the SSH command and password to connect to the Student VM
2. Demonstrate Authentication to OpenShift
| Skip this section if you already executed the steps in previous demonstrations. |
Action: Log in to the OpenShift Container Platform web console using your login credentials.
Explain: You are taken to the Projects page. The default view for the OpenShift Container Platform web console is the Administrator perspective.
3. Demonstrate the Developer Perspective
Explain: The OpenShift Container Platform web console provides two perspectives: the Administrator perspective and the Developer perspective. The Developer perspective provides workflows specific to developer use cases.
Action: Use the perspective switcher to switch to the Developer perspective. The Topology view with options to create an application is displayed.
4. Demonstrate New Project Creation
Explain: A Project allows a community of users to organize and manage their content in isolation from other communities. Projects are OpenShift extensions to Kubernetes namespaces, with additional features to enable user self-provisioning. For the vast majority of purposes, they are interchangeable.
Action: Click the Project drop-down menu to see a list of all available Projects. Select Create Project.
Explain: Different Projects can have different user permissions and quotas attached to them.
Action: Fill in the Name, Display Name, and Description fields as follows:
Name:
guid-exploring-templatesMake sure you replace
guidwith a unique identifier, such as your client’s name or the four-character identifier you received from OPENTLC. Project names must be unique in OpenShift.Display Name:
Exploring OpenShift TemplatesDescription:
This is the project for exploring the OpenShift Templates
5. Demonstrate Creating a New Application with a Template
Explain: OpenShift has created your Project, and forwarded your browser to the Topology page. You have no workloads in your Project to display on the Topology page, so options to deploy workloads are presented.
Action: Select From Catalog to view the Developer Catalog page.
Action: Select ONLY the Type of Template in order to filter available items.
Action: Type in the Filter by keyword… box the word node to filter the items to just the Node.js items.
Action: Select the non-ephemeral Node.js+MongoDB Template.
Action: Click Instantiate Template.
Action: Scroll down to the Database Administrator Password field and enter a password.
Explain: Point out the following:
There are more settings that you can define as you scroll down the page.
Passwords and other environment variables can be set as parameters; how these work in the deployed template is shown later in this demonstration.
Action: When you are done, click Create.
Action: Observe the resources of the template being created.
6. Demonstrate Template Parameters and Deployment Environment Variables
Action: In the Topology view, click the
nodejs-mongodb-persistentDeployment Config and the Overview Panel opens.Action: Click the Resources tab to show the Pods in this Deployment Config.
Action: Click the
nodejs-mongodb-persistent-xxxxxPod from the list of Pods (wherexxxxxis a unique alphanumerical identifier for your Pod).Action: Select the Terminal tab to open a terminal shell.
Action: In the terminal shell, type
echo $MONGODB_ADMIN_PASSWORDto see the deployment’s environment variable holding that password.Explain: You can see that the
MONGODB_ADMIN_PASSWORDfield is set to the password you chose during the template creation process.
Action: In the terminal shell, type
echo $MONGODB_PASSWORDto see the deployment’s environment variable holding that password.Explain: the
MONGODB_PASSWORDpassword was generated by OpenShift and is set to the same value in the other deployment.
Action: In the terminal shell, enter the
lscommand.Explain: Depending on your present working directory, you can see files in the container and manipulate them.
Action: In the terminal shell, enter the
ps -efcommand.Explain: This allows you to see the processes running inside your container.
Action: In the terminal shell, enter the
env |grep -i mongocommand.Explain: This allows you to see the environment variables, and that you can see the password shown here is the same as the one you set earlier in the demonstration.
Action: In the terminal shell, enter the
cat /etc/resolv.confcommand.Explain: This shows parameters associated with host name resolution, such as the default search domain and IP address of the DNS servers.
7. Clean Up Environment
If you are not going to do additional demonstrations, return to the home page in the OpenShift Container Platform web console and delete your Project.